include ../common.mk

CFLAGS_WRN:= -Wconversion -Wno-unused -Wno-strict-aliasing -Wextra

CFLAGS_IMGSRC  := -I$(SRC_PATH)
LDFLAGS_IMGSRC := $(LIB_PATH)/libimagesource.a -lm

CFLAGS = $(CFLAGS_STD) $(CFLAGS_UORC) $(CFLAGS_COMMON) $(CFLAGS_GLIB)  $(CFLAGS_LCM) $(CFLAGS_LCMTYPES) $(CFLAGS_IMGSRC) -D_GNU_SOURCE
LDFLAGS = $(LDFLAGS_STD) $(LDFLAGS_UORC) $(LDFLAGS_COMMON) $(LDFLAGS_GLIB) $(LDFLAGS_LCM) $(LDFLAGS_LCMTYPES)

# Test programs
TELEOP_TEST:=$(BIN_PATH)/teleop_test
PID_TEST:=$(BIN_PATH)/PID_control

BINARIES:= $(TELEOP_TEST) $(PID_TEST)

all: $(BINARIES)

$(TELEOP_TEST): teleop.o LinAlg.o 
	$(CC) -o $@ $^ $(LDFLAGS)

$(PID_TEST): PID_control.o LinAlg.o Line.o
	$(CC) -o $@ $^ $(LDFLAGS)

%.o: %.c
	@echo "    [$@]"
	$(CC) -c -o $@ $< $(CFLAGS)

clean:
	rm -f *.o $(BINARIES) *~

